﻿using System;
using System.Collections.Generic;
using fastCSharp;

namespace diantou.web.exam
{
    /// <summary>
    /// 用户题目回答信息
    /// </summary>
    struct userQuestionAnswer
    {
        /// <summary>
        /// 用户题目信息
        /// </summary>
        public diantou.examDataAccess.examAnswer.question Question;
        /// <summary>
        /// 用户信息
        /// </summary>
        public diantou.examDataAccess.examUser User;
        /// <summary>
        /// 题目编号
        /// </summary>
        public int Index;
        /// <summary>
        /// 用户题目信息
        /// </summary>
        /// <param name="question">用户题目信息</param>
        /// <param name="user">用户信息</param>
        /// <param name="index">题目编号</param>
        internal void Set(ref diantou.examDataAccess.examAnswer.question question, Dictionary<dataModel.examQuestion.questionType, diantou.dataModel.examAnswerBase> answers, diantou.examDataAccess.examUser user, int index)
        {
            Question = question;
            if (answers.ContainsKey(new dataModel.examQuestion.questionType { Type = question.Type, QuestionId = question.Id })) Question.IsAnswer = true;
            User = user;
            Index = index;
        }
    }
}
